package com.wuye.weixin;

import java.util.List;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.builder.*;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by jiawenlong on 2016/6/16.
 */
public class QyUser {
	public String toString() {
		try {
			return ReflectionToStringBuilder.toString(this,ToStringStyle.MULTI_LINE_STYLE);
		} catch (Exception e) {
			return e.getMessage();
		}
	}
     public QyUser() {
     }

    public QyUser(JSONObject jsonObject){
        this.userid=jsonObject.getString("userid");
        this.name=jsonObject.getString("name");
        this.position=jsonObject.getString("position");
        this.mobile=jsonObject.getString("mobile");
        this.email=jsonObject.getString("email");
        this.avatar=jsonObject.getString("avatar");
        this.extattr=jsonObject.get("extattr");
        Object[] aa= JSONArray.fromObject(jsonObject.getJSONArray("department")).toArray();
        department=new int[aa.length];
        for (int i=0;i<aa.length;i++){
            department[i]=Integer.valueOf(aa[i].toString());
        }
    }
        /**
     * 成员UserID。对应管理端的帐号
     */
    private String userid;
    /**
     * 成员名称
     */
    private String name;
    /**
     * 成员所属部门id列表
     */
    private int[] department ;
    /**
     * 职位信息
     */
    private String position;
    /**
     * 手机号码
     */
    private String mobile;
    /**
     * 性别。0表示未定义，1表示男性，2表示女性
     */
    private String gender;
    /**
     * 邮箱
     */
    private String email;
    /**
     * 微信号
     */
    private String weixinid;
    /**
     * 头像url。注：如果要获取小图将url最后的"/0"改成"/64"即可
     */
    private String avatar;
    /**
     * 关注状态: 1=已关注，2=已禁用，4=未关注
     */
    private String status;
    /**
     * 扩展属性
     */
    private Object extattr;


    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int[] getDepartment() {
        return department;
    }

    public void setDepartment(int[] department) {
        this.department = department;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getWeixinid() {
        return weixinid;
    }

    public void setWeixinid(String weixinid) {
        this.weixinid = weixinid;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getExtattr() {
        return extattr;
    }

    public void setExtattr(Object extattr) {
        this.extattr = extattr;
    }
}
